﻿namespace pay.sofort.test
{
    using System;
    using System.Diagnostics;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Models;

    [TestClass]
    public class TestMultipayManager : TestBase
    {
        [TestMethod]
        public void TestInitiatePayment()
        {
            TPaySofortConfig config = TPaySofortConfig.LoadFromFile(ConfigFileName);

            TPaySofortMultipayManager man = new TPaySofortMultipayManager(config);
            PaySofortMultipay paySofortMultipay = man.CreateMultipaySimple(1.00m);
            paySofortMultipay.reason_1 = "sofort.net - Test";
            paySofortMultipay.reason_2 = string.Format("Zeit {0:HHmmss}", DateTime.Now);
            paySofortMultipay.user_variable_1 = "Test";
            paySofortMultipay.su_customer_protection = false;

            PaySofortNewTransaction paySofortNewTransaction = man.SendMultipay(paySofortMultipay);

            Assert.IsNotNull(paySofortNewTransaction.payment_url);

            Process.Start(paySofortNewTransaction.payment_url);
        }

    }
}
